package com.lezheba.action;

import java.util.Date;

import org.apache.log4j.Logger;

import com.lezheba.db.entity.DaythInfo;
import com.lezheba.service.UserAdminService;

public class AdminAction extends BaseAction {
	private static final long serialVersionUID = 1012329652723613183L;
	static Logger logger = Logger.getLogger(AdminAction.class.getName());

	private UserAdminService service = new UserAdminService();

	private int dayth;
	private String path;
	private String title;
	private String content;
	private DaythInfo daythInfo;
	private Date date;
	private String email;

	public String review() throws Exception {
		if (dayth > 0) {
			daythInfo = service.get(dayth);
		}

		return SUCCESS;

	}

	public String input() throws Exception {
		if (dayth > 0) {
			if (title != null && content != null && title.length() > 0
					&& content.length() > 0) {
				service.saveOrUpdate(dayth, path, title, content);
			} else if (title == null && content == null) {
				daythInfo = service.get(dayth);
			}
		}
		return SUCCESS;

	}

	public DaythInfo getDaythInfo() {

		return daythInfo;
	}

	public void setDaythInfo(DaythInfo daythInfo) {
		this.daythInfo = daythInfo;
	}

	public String login() throws Exception {
		int tag = 0;

		return super.ajax(tag);

	}

	public int getDayth() {
		return dayth;
	}

	public void setDayth(int dayth) {
		this.dayth = dayth;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

}
